<template>
	<view>
		<view class="center710 overflow-hidden white-bj border-r-20 mar-top20 box-sizing">
			<!-- 插入模式 -->
			<uni-calendar class="uni-calendar--hook box-sizing" :selected="info.selected" :showMonth="false" @change="change" @monthSwitch="monthSwitch" />
		</view>
		<!-- 自动定义导航 -->
		<m-tabbar-item :tabIndex="tabIndex"></m-tabbar-item>
	</view>
</template>

<script>
	import mTabbarItem from "@/components/m-tabbar-item.vue"
	export default {
		components:{
			mTabbarItem
		},
		data() {
			uni.hideTabBar();
			return {
				tabIndex:3,
				mid:undefined,
				info: {
					selected: []
				}
			}
		},
		onLoad() {
			this.mid=parseFloat(this.$user.state.userId)
			if(this.mid>0){
				this.getShow()
			}
			//开启分享
			wx.showShareMenu({
				withShareTicket:true,
				menus:["shareAppMessage","shareTimeline"]
			})
		},
		//设置分享好友的内容
		onShareAppMessage(res) {
			if (res.from=="button"){
				console.log(res.target)
			}
			return {
				title:"鑫意到家",
				path: '/pages/index/index?rid=',
				desc:"鑫意到家 · 洁新留下！",
				imageUrl:"../../static/202310131154405365.png"
			}
		},
		//分享朋友圈
		onShareTimeline(res) {
			return {
				title: '鑫意到家 · 洁新留下！',
				type: 0,
				summary: "鑫意到家 · 洁新留下！",
			}
		},
		onShow() {
			this.mid=parseFloat(this.$user.state.userId)
			if(this.mid>0){
				this.getShow()
			}
		},
		methods: {
			change(e){
				console.log(e)
			},
			//获取预约详情
			async getShow(){
				const one={
					mid:this.mid
				}
				this.$api.GetYueList(one).then(res=>{
					if(res.data.length>0){
						const Arr=[]
						res.data.forEach(item=>{
							const two={
								date: item.yu_yue_date,
								info: '有预约'
							}
							this.info.selected.push(two)
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	body{
	    background-color: #f6f6f6;  
	} 
	.example-body {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
	}
	.calendar-button {
		flex: 1;
		font-weight: bold;
		font-size: 32rpx;
	}
</style>
